<template>
  <dialog-form
    v-if="visible"
    width="600px"
    :title="title"
    :visible="visible"
    :form-attrs="{formData: modalFormData, renderFormItem, formButtons, labelWidth: '100px'}"
    @close="handleClose"
  />
</template>

<script>
import { DialogForm } from '@/components'
import { modalFormItem, formButtons } from './config'

export default {
  name: 'Qualityupdate',
  components: { DialogForm },
  props: {
    title: {
      type: String,
      default: ''
    },
    visible: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      renderFormItem: modalFormItem,
      modalFormData: {},
      formButtons: formButtons(this.handleSubmit, this.handleClose)
    }
  },
  methods: {
    handleSubmit(values) {
      this.$emit('handleModalSubmit', values)
    },

    handleClose() {
      this.$emit('update:visible', false)
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
